#ifndef __MULTI_SCALE_TILE_SOURCE_H__
#define __MULTI_SCALE_TILE_SOURCE_H__

#include "config.h"
#include "DeepZoomImageDLL.h"

namespace DeepZoomImage
{
	class MultiScaleTileSource;

	typedef bool (*get_image_tile_func) (MultiScaleTileSource *msts, int level, int posX, int posY, void **tile );

	class DEEP_ZOOM_IMAGE_DLL MultiScaleTileSource
	{
	public:
		MultiScaleTileSource ();
		virtual ~MultiScaleTileSource () {}

		void ref();
		void unref();

		inline double GetImageWidth () { return m_ImageWidth; }
		inline void SetImageWidth (double width) { m_ImageWidth = width; }

		inline double GetImageHeight () { return m_ImageHeight; }
		inline void SetImageHeight (double height) { m_ImageHeight = height; }

		inline int GetTileWidth () { return m_TileWidth; }
		inline void SetTileWidth (int width) { m_TileWidth = width; }

		inline int GetTileHeight () { return m_TileHeight; }
		inline void SetTileHeight (int height) { m_TileHeight = height; }

		inline int GetTileOverlap () { return m_TileOverlap; }
		inline void SetTileOverlap (int overlap) { m_TileOverlap = overlap; }

		inline TimeSpan GetTileBlendTime () { return m_TileBlendTime; }
		inline void SetTileBlendTime (TimeSpan time) { m_TileBlendTime = time; }

		void InvalidateTileLayer (int level, int tilePositionX, int tilePositionY, int tileLayer);

		get_image_tile_func get_tile_func;

	protected:
		double m_ImageWidth;
		double m_ImageHeight;
		int m_TileWidth;
		int m_TileHeight;
		int m_TileOverlap;
		TimeSpan m_TileBlendTime;

	private:
		gint32 refcount;
	};
}
#endif /* __MULTI_SCALE_TILE_SOURCE_H__ */
